package com.flurry.android;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.RelativeLayout.LayoutParams;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

final class em extends AdNetworkView
{
  private static final String gm = em.class.getSimpleName();
  private final boolean bU;
  private final String gn;
  private final String q;

  public em(Context paramContext, FlurryAds paramFlurryAds, cw paramcw, AdCreative paramAdCreative, Bundle paramBundle)
  {
    super(paramContext, paramFlurryAds, paramcw, paramAdCreative);
    this.q = paramBundle.getString("com.flurry.admob.MY_AD_UNIT_ID");
    this.gn = paramBundle.getString("com.flurry.admob.MYTEST_AD_DEVICE_ID");
    this.bU = paramBundle.getBoolean("com.flurry.admob.test");
    setFocusable(true);
  }

  public final void initLayout(Context paramContext)
  {
    int i = getAdCreative().getWidth();
    int j = getAdCreative().getHeight();
    DisplayMetrics localDisplayMetrics = paramContext.getResources().getDisplayMetrics();
    int k = (int)(localDisplayMetrics.heightPixels / localDisplayMetrics.density);
    int m = (int)(localDisplayMetrics.widthPixels / localDisplayMetrics.density);
    label75: AdSize localAdSize;
    if ((i <= 0) || (i > m))
    {
      if ((j > 0) && (j <= k))
        break label146;
      if ((m < 728) || (k < 90))
        break label152;
      localAdSize = AdSize.IAB_LEADERBOARD;
    }
    while (true)
    {
      if (localAdSize != null)
        break label236;
      cy.d(gm, "Could not find Admob AdSize that matches {width = " + i + ", height " + j + "}");
      return;
      m = i;
      break;
      label146: k = j;
      break label75;
      label152: if ((m >= 468) && (k >= 60))
      {
        localAdSize = AdSize.IAB_BANNER;
      }
      else if ((m >= 320) && (k >= 50))
      {
        localAdSize = AdSize.BANNER;
      }
      else if ((m >= 300) && (k >= 250))
      {
        localAdSize = AdSize.IAB_MRECT;
      }
      else
      {
        Log.d("FlurryAgent", "Could not find AdMob AdSize that matches size");
        localAdSize = null;
      }
    }
    label236: cy.c(gm, "Determined Admob AdSize as " + localAdSize + " that best matches {width = " + i + ", height = " + j + "}");
    AdView localAdView = new AdView((Activity)paramContext, localAdSize, this.q);
    localAdView.setAdListener(new w(this));
    setGravity(17);
    addView(localAdView, new RelativeLayout.LayoutParams(localAdSize.getWidthInPixels(paramContext), localAdSize.getHeightInPixels(paramContext)));
    AdRequest localAdRequest = new AdRequest();
    if (this.bU)
    {
      cy.c(gm, "Admob AdView set to Test Mode.");
      localAdRequest.addTestDevice(AdRequest.TEST_EMULATOR);
      if (!TextUtils.isEmpty(this.gn))
        localAdRequest.addTestDevice(this.gn);
    }
    localAdView.loadAd(localAdRequest);
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.em
 * JD-Core Version:    0.6.2
 */